<?php echo $this->Html->script(array('ckeditor/ckeditor','ckfinder/ckfinder')); ?>
<h2><?php echo __('Menu Management', true); ?><span style="padding-left:700px; color: #333; font-size:12px; text-transform:none;"><img src="img/plus_circle.png"><?php echo __('Add Items', true); ?></span></h2>
<div id="container">
	
    <form name="frm" id="frm" method="post" action="<?php echo Router::url('/pictures/add', true)?>" enctype="multipart/form-data">    
      <table>    
        <tr>      
          <td colspan="2"><label for="name"><?php echo __('Name', true); ?></label></td>    
          <td colspan="2">
    		<?php echo $this->Form->input('Picture.name', array('type' => 'text', 'label' => false, 'div' => false)); ?>      	
          </td>    
        </tr>    
        <tr>      
          <td colspan="2"><label for="address1"><?php echo __('Image', true); ?></label></td>    
          <td colspan="2">
          	<?php //echo $form->input('Picture.link', array('type'=>'file', 'label' => false, 'div'=> false)); ?>
          	<input id="xFilePath" name="data[Picture][link]" type="text" size="60" />
			<input type="button" value="Browse Server" onclick="BrowseServer();" />
          	<Script>
          	function BrowseServer()
			{
				// You can use the "CKFinder" class to render CKFinder in a page:
				var finder = new CKFinder();
				finder.basePath = '../../';	// The path for the installation of CKFinder (default = "/ckfinder/").
				finder.selectActionFunction = SetFileField;
				finder.popup();
			
				// It can also be done in a single line, calling the "static"
				// Popup( basePath, width, height, selectFunction ) function:
				// CKFinder.Popup( '../../', null, null, SetFileField ) ;
				//
				// The "Popup" function can also accept an object as the only argument.
				// CKFinder.Popup( { BasePath : '../../', selectActionFunction : SetFileField } ) ;
			}
			
			// This is a sample function which is called when a file is selected in CKFinder.
			function SetFileField( fileUrl )
			{
				document.getElementById( 'xFilePath' ).value = fileUrl;
			}
			</Script>
		 </td>    
        </tr> 
        <tr>   
          <td colspan="2"><label for="address2"><?php echo __('Menu', true); ?></label></td>    
          <td colspan="2">
          	
          	<?php echo $this->Form->input('Picture.kind', array('type' => 'select', 'options' => $menus, 'label' => false, 'div' => false)); ?>
          </td>    
        </tr>  
        <tr>      
          <td colspan="2"><label for="address2"><?php echo __('Status', true); ?></label></td>    
          <td colspan="2">
          	<?php echo $this->Form->checkbox('Picture.status', array('label' => false, 'div' => false)); ?>
          </td>    
        </tr>   
        <tr>      
          <td colspan="4"><input type="submit" name="Submit" value="Submit" tabindex="8" /></td>    
        </tr>    
      </table>    
    </form> 
   </div> 
